#define _CRT_SECURE_NO_WARNINGS
#include "sort.h"
void PrintArray(int* a, int n)
{
	assert(a);
	for (int i = 0; i < n; i++)
	{
		printf("%d ", a[i]);
	}
	printf("\n");
}
void TestBubbleSort()
{
	//int a[] = { 6, 2, 5, 3, 9, 4, 8, 5, 1, 7 };
	int a[] = { 26, 2, 5, 3, 9, 4, 8, 5, 1, 7 };
	PrintArray(a, sizeof(a) / sizeof(int));

	BubbleSort(a, sizeof(a) / sizeof(int));

	PrintArray(a, sizeof(a) / sizeof(int));
}

void TestQuickSort()
{
	int a[] = { 6, 2, 5, 3, 9, 4, 8, 5, 1, 7 };
	//int a[] = { 26, 2, 5, 3, 9, 4, 8, 5, 1, 7 };
	PrintArray(a, sizeof(a) / sizeof(int));

	QuickSort(a, 0, sizeof(a) / sizeof(int) - 1);

	PrintArray(a, sizeof(a) / sizeof(int));
}
void TestQuickSortNonR()
{
	int a[] = { 6, 2, 5, 3, 9, 4, 8, 5, 1, 7 };
	//int a[] = { 26, 2, 5, 3, 9, 4, 8, 5, 1, 7 };
	PrintArray(a, sizeof(a) / sizeof(int));

	QuickSortNonR(a, 0, sizeof(a) / sizeof(int) - 1);

	PrintArray(a, sizeof(a) / sizeof(int));
}
void TestMergeSort()
{
	int a[] = { 6, 2, 5, 3, 9, 4, 8, 5, 1, 7 };
	//int a[] = { 26, 2, 5, 3, 9, 4, 8, 5, 1, 7 };
	PrintArray(a, sizeof(a) / sizeof(int));

	MergeSort(a, sizeof(a) / sizeof(int) - 1);

	PrintArray(a, sizeof(a) / sizeof(int));
}

int main()
{
	//TestBubbleSort();
	//TestQuickSort();
	//TestQuickSortNonR();
	TestMergeSort();
	return 0;
}